@extends('layouts.backend')
@section('title')
    添加分类
@endsection

@section('body')
    <div class="row">
        <div class="ibox">
            <div class="ibox-title">
                <h5>添加分类</h5>
                <a href="{{route('backend.category.index')}}" class="btn btn-primary pull-right">返回列表</a>
                <div class="clearfix"></div>
            </div>
            <div class="ibox-content">

                <div class="row">
                    <div class="col-md-8">
                        <form method="post" class="form-horizontal" >
                            @csrf
                            <div class="form-group"><label class="col-sm-3 control-label">名称@include('components.backend.required')</label>
                                <div class="col-sm-9"><input type="text" name="name" placeholder="请输入分类名称" class="form-control" required></div>
                            </div>
                            <div class="form-group"><label class="col-sm-3 control-label">描述 @include('components.backend.required')</label>
                                <div class="col-sm-9">
                                    <textarea name="description" class="form-control" cols="30" rows="5" placeholder="请输入描述" required></textarea>
                                </div>
                            </div>
                            <div class="form-group"><label class="col-sm-3 control-label">父级分类@include('components.backend.required')</label>
                                <div class="col-sm-9">
                                    <select name="pid"  class="form-control">
                                        <option value="0">顶级</option>
                                        @forelse($categories as $category)
                                            <option value="{{$category->id}}">{{$category->name}}</option>
                                        @empty
                                        @endforelse
                                    </select>
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2 pull-right">
                                    <button class="btn btn-primary" type="submit">添加</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>

            </div>
        </div>
    </div>
@endsection
